<?php

namespace app\admin\command;

use app\common\util\Tools;
use think\console\Input;
use think\console\Output;
use think\facade\Log;

class SystemTest extends CommonTest
{

    //再命令窗口中执行“php think interface-SystemTest”
    protected function configure()
    {
        $this->setName('interface-SystemTest')
            ->setDescription('接口测试');
    }

    public function execute(Input $input, Output $output)
    {
        parent::execute($input, $output);

        /** 配置设置管理 */

        //Route::any('admin/system/getSiteInfo', 'admin/system/getSiteInfo');                                                     // 站点信息
//        $data = Tools::curl($this->url . "admin/system/getSiteInfo", json_encode(["token" => "$this->token"]));
//        Log::write("post". var_export($data,true));
//        echo $data . "\n\n";
//        echo print_r(json_decode($data,1)) . "\n\n";

        //Route::any('admin/system/getConfig/wxApp', 'admin/system/getConfigInfo');                                               // 获取微信小程序配置信息
//        $data = Tools::curl($this->url . "admin/system/getConfig/wxApp", json_encode(["token" => "$this->token"]));
//        Log::write("post". var_export($data,true));
//        echo $data . "\n\n";
//        echo print_r(json_decode($data,1)) . "\n\n";
////
////        //Route::any('admin/system/saveConfig/:type', 'admin/system/getSaveConfig');                                              // 保存微信小程序配置信息
//        $data = Tools::curl($this->url . "admin/system/saveConfig/wxApp", json_encode(["token" => "$this->token", "appId" => "wx0b6ed60db99cde18", "appSecret" => "4e719228df0272bf1473850033a37b71", "paySecret" => "xx", "payMch" => "xx"]));
//        Log::write("post". var_export($data,true));
//        echo $data . "\n\n";
//        echo print_r(json_decode($data,1)) . "\n\n";
//
//        //Route::any('admin/system/getSmsInfo', 'admin/system/getSmsInfo');                                                       // 获取短信配置信息
//        $data = Tools::curl($this->url . "admin/system/saveConfig/sms", json_encode(["token" => "$this->token", "appId" => "wxxx", "appSecret" => "wx", "paySecret" => "xx", "payMch" => "xx"]));
//        Log::write("post". var_export($data,true));
//        echo $data . "\n\n";
//        echo print_r(json_decode($data,1)) . "\n\n";

        //Route::any('admin/system/getWxMessageInfo', 'admin/system/getWxMessageInfo');                                           // 获取短信配置信息
//        $data = Tools::curl($this->url . "admin/system/getConfig/wxMessage", json_encode(["token" => "$this->token"]));
//        Log::write("post". var_export($data,true));
//        echo $data . "\n\n";
//        echo print_r(json_decode($data,1)) . "\n\n";
//
//        //Route::any('admin/system/getWxMessageInfo', 'admin/system/getWxMessageInfo');                                           // 获取短信配置信息
//        $data = Tools::curl($this->url . "admin/system/saveConfig/wxMessage", json_encode(["token" => "$this->token", "registerTpl" => "sdfsdf"]));
//        Log::write("post". var_export($data,true));
//        echo $data . "\n\n";
//        echo print_r(json_decode($data,1)) . "\n\n";

        //admin/system/getConfig/loginConf
//        $data = Tools::curl($this->url . "admin/system/getConfig/loginConf", json_encode(["token" => "$this->token"]));
//        Log::write("post". var_export($data,true));
//        echo $data . "\n\n";
//        echo print_r(json_decode($data,1)) . "\n\n";
//
//        //
//        $data = Tools::curl($this->url . "admin/system/saveConfig/loginConf", json_encode(["token" => "$this->token", "siteTitle" => "安顺达租车", "seoTitle" => "安顺达租车", "copyright" => "Copyright © 2017-2019 网商云计算. All rights reserved."]));
//        Log::write("post". var_export($data,true));
//        echo $data . "\n\n";
//        echo print_r(json_decode($data,1)) . "\n\n";

        //admin/system/getConfig/lineRemark
//        $data = Tools::curl($this->url . "admin/system/getConfig/lineRemark", json_encode(["token" => "$this->token"]));
//        Log::write("post". var_export($data,true));
//        echo $data . "\n\n";
//        echo print_r(json_decode($data,1)) . "\n\n";
//
//        //
//        $data = Tools::curl($this->url . "admin/system/saveConfig/lineRemark", json_encode(["token" => "$this->token", "registerTpl" => "sdfsdf"]));
//        Log::write("post". var_export($data,true));
//        echo $data . "\n\n";
//        echo print_r(json_decode($data,1)) . "\n\n";

        //admin/system/getConfig/withdraw
//        $data = Tools::curl($this->url . "admin/system/getConfig/withdraw", json_encode(["token" => "$this->token"]));
//        Log::write("post". var_export($data,true));
//        echo $data . "\n\n";
//        echo print_r(json_decode($data,1)) . "\n\n";
//
//        //
//        $data = Tools::curl($this->url . "admin/system/saveConfig/withdraw", json_encode(["token" => "$this->token", "registerTpl" => "sdfsdf"]));
//        Log::write("post". var_export($data,true));
//        echo $data . "\n\n";
//        echo print_r(json_decode($data,1)) . "\n\n";

        //admin/system/getConfig/withdraw
//        $data = Tools::curl($this->url . "admin/system/getConfig/qCloud", json_encode(["token" => "$this->token"]));
//        Log::write("post". var_export($data,true));
//        echo $data . "\n\n";
//        echo print_r(json_decode($data,1)) . "\n\n";

        ///admin/system/getConfig/lineMenu
//        $data = Tools::curl($this->url . "admin/system/getConfig/lineMenu", json_encode(["token" => "$this->token"]));
//        Log::write("post". var_export($data,true));
//        echo $data . "\n\n";
//        echo print_r(json_decode($data,1)) . "\n\n";

        ///admin/system/saveConfig/lineMenu
//        $data = Tools::curl($this->url . "admin/system/saveConfig/lineMenu", json_encode(["token" => "$this->token", "content" => [5]]));
//        Log::write("post". var_export($data,true));
//        echo $data . "\n\n";
//        echo print_r(json_decode($data,1)) . "\n\n";

        $data = Tools::curl($this->url . "admin/system/getConfig/ruleContent", json_encode(["token" => "$this->token", "content" => [5]]));
        Log::write("post". var_export($data,true));
        echo $data . "\n\n";
        echo print_r(json_decode($data,1)) . "\n\n";

        $data = Tools::curl($this->url . "admin/system/saveConfig/ruleContent", json_encode(["token" => "$this->token", "ruleContent" => "xxxxxxx", "refundVerifyStatus" => 0]));
        Log::write("post". var_export($data,true));
        echo $data . "\n\n";
        echo print_r(json_decode($data,1)) . "\n\n";

        //
//        $smsData = [
//            "secretId" => "AKIDZsxnN35OytacO5mt1thqvGMCm8ZktT0t", // API密钥ID
//            "secretKey" => "N4YmlRuMXWhcJp56TaR9bcCXcTxC4hpi", // API密钥KEY
//            "bucket" => "car-1251017581", // bucket 的命名规则为{name}-{appid} ，此处填写的存储桶名称必须为此格式
//            "region" => 'ap-guangzhou', //地域，如ap-guangzhou,ap-beijing-1
//            "token" => $this->token
//        ];
//        $data = Tools::curl($this->url . "admin/system/saveConfig/qCloud", json_encode($smsData));
//        Log::write("post". var_export($data,true));
//        echo $data . "\n\n";
//        echo print_r(json_decode($data,1)) . "\n\n";
    }
}
